<template>
  <div class="login">
    <el-container>
      <el-header class="login-header clearfloat">
        <img
          src="../assets/img/xh_logo.png"
          style="width:65px;height: 65px;"
          alt
          v-if="'from' in $route.query && $route.query.from == 1"
        />
        <a href class="header_logo" v-else></a>
        <!-- <span class="header_text" v-if="isShow">华中科技大学同济医学院附属协和医院</span> -->
        <span class="header_text" v-if="'from' in $route.query && $route.query.from == 1">华中科技大学同济医学院附属协和医院</span>
        <span class="header_text" v-else>武汉溟宇科惠知识产权服务平台</span>
        <!-- <el-row
          class="header_enterprise"
          type="flex"
          v-if="$route.fullPath !='/login?type=1' && $route.fullPath !='/login?type=1&from=1' && $route.path != '/companyLogin' && $route.path != '/agentRegister' && $route.path != '/register' && $route.path != '/forgotPassword' && $route.path != '/companyRegister'"
        >
          <el-col :span="11" align="middle">
            <span
              v-if="'from' in $route.query && $route.query.from == 1"
              @click="$router.push('/companyLogin?from=1')"
            >&emsp;企业登录</span>
            <span v-else @click="$router.push('/companyLogin')">&emsp;企业登录</span>
          </el-col>
          <el-col :span="2" align="middle">|</el-col>
          <el-col :span="11" align="middle">
            <span @click="selectPort(1)">代理人登录</span>
          </el-col>
        </el-row> -->
        <!-- <span
          class="header_enterprise_per"
          v-if="$route.fullPath =='/login?type=1' || $route.fullPath =='/login?type=1&from=1'"
          @click="goBack"
        >返回</span>
        <span
          class="header_enterprise_per"
          v-if="$route.path != '/login' && $route.path != '/' && $route.path != '/companyLogin'"
          @click="$router.push('/')"
        >个人登录</span>
        <span
          class="header_enterprise_per"
          v-if="$route.path == '/companyLogin' || $route.path == '/companyLogin?from=1'"
          @click="goBack"
        >返回</span> -->
      </el-header>
      <el-main class="login-main">
        <nuxt-child keep-alive />
      </el-main>
      <div class="login-footer">
        <p class="record tc" v-html="record"></p>
        <div class="company tc">
          <span class="company_text" style="margin-right:15px">技术支持</span>
          <a href class="company_logo"></a>
          <span class="company_text">武汉溟宇科惠知识产权服务有限公司</span>
        </div>
      </div>
    </el-container>
  </div>
</template>

<script>
import { SITE_NAME, RECORD } from "~/util/config";
export default {
  data() {
    return {
      isShow: false,
      record: RECORD,
      agentBack: true
    };
  },
  created() {},
  // watch:{
  //   $route(to,from){
  //     if(this.$route.query){
  //       if(this.$route.query.type == 1){
  //         this.agentBack = false
  //       }
  //       this.$forceUpdate();
  //     }else {
  //       this.agentBack = true
  //     }
  //   }
  // },
  methods: {
    goBack() {
      this.$router.push("/");
    },
    companyLogin() {},
    selectPort(type) {
      if ("from" in this.$route.query) {
        this.isShow = true;
        this.$router.push({
          path: "/login",
          query: {
            type: type,
            from: 1
          }
        });
      } else {
        this.isShow = false;
        this.$router.push({
          path: "/login",
          query: {
            type: type
          }
        });
      }
    }
  }
};
</script>

<style lang='less'>
// .el-main {
//   overflow: unset;
// }
.login {
  width: 100%;
  height: 100%;

  .el-container {
    width: 100%;
    height: 100%;

    .login-header {
      height: 90px !important ;
      background: rgba(255, 255, 255, 1);
      padding: 0px 25px;
      display: flex; /*Flex布局*/
      display: -webkit-flex; /* Safari */
      align-items: center; /*指定垂直居中*/
      position: relative;

      .header_logo {
        display: inline-block;
        width: 65px;
        height: 31px;
        background: url(../assets/img/图标.png) no-repeat;
        background-position: -553px -432px;
        img {
          width: 100%;
        }
      }
      .header_text {
        font-size: 24px;
        font-family: Source Han Sans CN;
        font-weight: 700;
        color: rgba(27, 27, 27, 1);
        margin: 0 12px 0 8px;
      }
      .header_loginType {
        display: flex; /*Flex布局*/
        display: -webkit-flex; /* Safari */
        align-items: center; /*指定垂直居中*/
        height: 28px;
        padding: 4px 12px;
        border-left: 1px solid rgba(220, 220, 220, 1);
        font-size: 20px;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: rgba(27, 27, 27, 1);
        box-sizing: border-box;
        cursor: pointer;
      }
      .header_enterprise {
        width: 240px;
        font-size: 18px;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: rgba(27, 27, 27, 1);
        cursor: pointer;

        position: absolute;
        right: 25px;
      }
      .header_enterprise_per {
        font-size: 18px;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: rgba(27, 27, 27, 1);
        cursor: pointer;

        position: absolute;
        right: 25px;
      }
    }
    .login-main {
      padding: 0;
      // background: url('../assets/img/login_bg.jpg') no-repeat;
      background: rgba(244, 246, 255, 1);
      background-size: cover;
      position: relative;
    }
    .login-footer {
      height: 114px !important;
      width: 100%;
      padding-top: 20px;
      font-size: 15px;
      color: rgba(51, 51, 51, 1);
      // position:fixed;
      // bottom: 0;
      background: url("../assets/img/login_bg.jpg") no-repeat;
      background-size: cover;
      background-position: bottom 0px right 0px;
      .record {
      }
      .company {
        margin-top: 20px;
        .company_logo {
          display: inline-block;
          width: 48px;
          height: 22px;
          background: url("../assets/img/图标.png") no-repeat;
          background-position: -282px -393px;
        }
        .company_text {
          margin-left: 19px;
          display: inline-block;
          vertical-align: top;
        }
      }
    }
  }
}
</style>